echo "停服务"

dev_path="/mnt/bbs/api/"
server_name="bbs-api"
scp_ip="root@117.34.99.190:/mnt/bbs/api/"

log_path="${dev_path}/logs"

# 配置文件
echo "复制配置文件"

scp bbs-go.test.yaml "$scp_ip"/bbs-go.dev.yaml

ssh root@117.34.99.190 "supervisorctl stop "$server_name""

echo "编译文件"  
GOOS=linux GOARCH=amd64 go build -o "$server_name" main.go

echo "复制文件"  
scp "$server_name" "$scp_ip"

echo "启动服务"
ssh root@117.34.99.190 "supervisorctl start "$server_name""

rm -f "$server_name"

echo "发布成功"